#ifndef DECODERWIDGET_H
#define DECODERWIDGET_H

#include <QWidget>
#include <QTimer>
#include <QCamera>
#include <QCameraViewfinder>
#include <QCameraImageCapture>
#include <QCameraInfo>
#include <QLabel>

#include "QZXing.h"

namespace Ui {
class DecoderWidget;
}

class DecoderWidget : public QWidget
{
    Q_OBJECT

public:
    explicit DecoderWidget(QWidget *parent = 0);
    ~DecoderWidget();

private slots:
    void on_videoTime();
    void cameraImageCaptured(int i, QImage img);
    void cameraImageCaptured2(int i, QImage img);
    void on_btnInput_clicked();
    void on_btnInput_2_clicked();
    void on_pushButton_clicked();
    void on_pushButton_export_clicked();
    void on_pushButton_2_clicked();

private:
    Ui::DecoderWidget *ui;
    QZXing* decode;         //二维码解码器
    QString code1,code2;
    QStringList codeList;   //对比的二维码信息
    //读取摄像头
    QCamera *m_pCamera1;
    QCamera *m_pCamera2;

    //获取摄像头当前帧
    QCameraImageCapture *m_pImageCapture1;
    QCameraImageCapture *m_pImageCapture2;

    bool videoOpen1,videoOpen2;

    QTimer *videoTime;

    QList<QCameraInfo> CameraInfoList;

    void resultCheckUpdata();
    void setLabStatus(QLabel *lab, QString text, QColor color);
    void showHintLabel(QWidget *parent,
                              QString strText,
                              QString strFontSize = "16px",
                              QString strColor = "#ffffff",
                       QString strBgColor = "#202020"); //一个提示便签  会淡化消失
    void addTableData(QString code1, QString code2);
    void initUI();
    QImage AdjustContrast(QImage Img, int iContrastValue); //对比度调整函数
};

#endif // DECODERWIDGET_H
